#ifndef __SOCKET_H__
#define __SOCKET_H__

class InetAddress;

class Socket
{
public:
    Socket(int sockfd);
    Socket();
    ~Socket();

    int fd() {return sockfd_;}

    void nonblock();
    void shutdownWrite();
	static InetAddress getLocalAddr(int sockfd);
	static InetAddress getPeerAddr(int sockfd);

private:
    static int createSocketFd();
    static void setNonblock(int fd);
    static void setReuseAddr(int fd, bool flag=true);

private:
    int sockfd_;
};

#endif
